package model;

import java.io.File;

import cs.remoteapp.Message;

/**
 * Class representing a fileMessage on the local application
 * Package  model
 * Project ChatSystemG5 - INSA 4INFOA1 - 2013/2014
 * @author Thomas Vuillemin Martin Conant
 */
public class FileMessage extends Message {

		/**
		 * Constant representing the state
		 */
		public static final int WAITINGANSWER = 0;
		public static final int SENDINGFILE = 1;
		public static final int ABORTED = 2;
		public static final int COMPLETED = 3;
		public static final int ACCEPTED =4 ;
		public static final int REFUSED =5 ;



		private int state;
		
		/**
		 *  @brief Serialization id
		 */
		private static final long serialVersionUID = 1946169464483662060L;
		
		/**
		 * the file to be sent to the remote app or received from the remote app
		 */
		private File file;
		
		/**
		 * Constructor, initializate the state to WAITINGANSWER
		 * @param username the Username of the adresee
		 * @param file
		 */
		public FileMessage(String username, File file) {
			super(username);
			this.file= file;
			this.state=WAITINGANSWER;
		}


		/**
		 * get the file to be sent /received file
		 * @return file the file to send /received file
		 */
		public File getFile() {
			return file;
		}
		
		/**
		 * set the file to be sent 
		 * @param file the file to be sent
		 */
		public void setFile(File file) {
			this.file = file;
		}
		

	/**
	 * Get the state of the message
	 * @return the state
	 */
	public int getState() {
		return state;
	}

	/**
	 * Set the state of the message
	 * @param state Int representing the new state
	 */
	public void setState(int state) {
		this.state = state;
	}

}
